home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / pubpoint_ads.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  14.3 KB  |  384 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="include/wmsConstants.inc"-->
  3. <!--#include file="include/wmsLocStrings.inc"-->
  4. <!--#include file="include/wmsCommon.inc"-->
  5. <!--#include file="include/wmsHeader.inc"-->
  6. <!--#include file="include/wmsRefresh.inc"-->
  7. <!--#include file="include/wmsServerHash.inc"-->
  8. <!--#include file="include/wmsconnect.inc"-->
  9. <!--#include file="include/wmsError.inc"-->
  10. <!--#include file="include/wmsToolbar.inc"-->
  11. <!--#include file="include/wmsHelp.inc"-->
  12. <!--#include file="include/wmsPageBanner.inc"-->
  13. <!--#include file="include/wmsTabs.inc"-->
  14. <%
  15. '+-------------------------------------------------------------------------
  16. '
  17. '  Microsoft Windows Media
  18. '  Copyright (C) Microsoft Corporation. All rights reserved.
  19. '
  20. '  File:       PubPoint_Ads.asp
  21. '
  22. '  Contents:
  23. '
  24. '--------------------------------------------------------------------------
  25.  
  26. BeginErrorHandling
  27. ConnectToServer
  28. ConnectToPubPoint
  29.  
  30. Dim bWrapperPathEnabled
  31. Dim strCurrentWrapperPath
  32. Dim dwTotAds
  33. Dim strTrimmedOp
  34. Dim bError
  35. Dim bReloadedForPathError
  36. Dim strNewPath
  37.  
  38. if( empty = g_objPubPoint ) then
  39.     Server.Transfer( "pubpoint_collection.asp" )
  40. end if
  41.  
  42. dwTotAds = g_objPubPoint.TotalCounters.Advertisements
  43.  
  44. bWrapperPathEnabled = g_objPubPoint.EnableWrapperPath
  45. strCurrentWrapperPath = g_objPubPoint.WrapperPath
  46.  
  47. bError = FALSE
  48. bReloadedForPathError = FALSE
  49. strNewPath = ""
  50.  
  51. '////////////////////////////////////////////////////////////////
  52. Function GetFormStr( szKey )
  53.     GetFormStr = trim( CStr( posting( szKey ) ) )
  54. End Function
  55.  
  56.  
  57. '////////////////////////////////////////////////////////////////
  58. Function GetPostOrQsVal( szKey )
  59.     Dim szVal
  60.     szVal = GetFormStr( szKey )
  61.  
  62.     if( 0 = Len( szVal ) ) then
  63.         szVal = CStr( qs( szKey ) )
  64.     end if
  65.  
  66.     GetPostOrQsVal = szVal
  67. End Function
  68.  
  69.  
  70. '////////////////////////////////////////////////////////////////
  71. Function UnescapeFilePathSlashes( szUrl )
  72.     UnescapeFilePathSlashes = Replace( szUrl, "\", "\\" )
  73. End Function
  74.  
  75. '////////////////////////////////////////////////////////////////
  76. strTrimmedOp = RemoveDangerousCharacters( GetPostOrQsVal( "op" ) )
  77.  
  78. if( 0 = strcomp( strTrimmedOp, "ChangeWrapper", vbTextCompare ) ) then
  79.     on error resume next
  80.     strNewPath = CStr( trim( GetPostOrQsVal("path") ) )
  81.     
  82.     if( 0 < Len( strNewPath ) ) then
  83.         strNewPath = SafeUnescape( strNewPath )
  84.     end if 
  85.     
  86.     g_objPubPoint.WrapperPath = strNewPath
  87.     strCurrentWrapperPath = g_objPubPoint.WrapperPath
  88.     
  89.     if( 0 = Len( strCurrentWrapperPath ) ) and ( bWrapperPathEnabled ) then
  90.         g_objPubPoint.EnableWrapperPath = FALSE
  91.         bWrapperPathEnabled = FALSE
  92.     end if
  93.     if ErrorDetected( "WrapperPath" ) then
  94.         bError = TRUE
  95.     end if
  96.  
  97. elseif( 0 = strcomp( strTrimmedOp, "togglepath", vbTextCompare ) ) then
  98.     on error resume next
  99.     if( "on" = qs( "enableWrapper" ) ) then
  100.         g_objPubPoint.EnableWrapperPath = TRUE
  101.         bWrapperPathEnabled = TRUE
  102.     else
  103.         g_objPubPoint.EnableWrapperPath = FALSE
  104.         bWrapperPathEnabled = FALSE
  105.     end if
  106.     if ErrorDetected( "EnableWrapper" ) then
  107.         bError = TRUE
  108.     end if
  109.     
  110. elseif( 0 = strcomp( strTrimmedOp, "resetpeak", vbTextCompare ) ) then
  111.     g_objPubPoint.TotalCounters.Reset()
  112.     Response.Redirect( "pubpoint_ads.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID )
  113.     Response.Flush
  114.  
  115. elseif( 0 < Len( qs( "invalidPath" ) ) ) then
  116.     strNewPath = SafeUnescape( qs( "invalidPath" ) )
  117.     bReloadedForPathError = TRUE
  118. end if
  119.  
  120. WriteHTMLHeader( g_strDecodedServerName )
  121. WriteRefreshMetaTag
  122. %>
  123. <link rel="stylesheet" type="text/css" href="<%= Session( "cssName" ) %>">
  124. <script language="JavaScript" src="include/WMSCommon.js"></script>
  125. <script language="JavaScript">
  126. <!--
  127. /*@cc_on @*/
  128. <% WriteCommonJSUtils %>
  129. ///////////////////////////////////////////////////////////////////////
  130. function Reset()
  131. {
  132.     <% jsTRY %>
  133.     document.location.replace( "<%= "pubpoint_ads.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&op=ResetPeak"%>" );
  134.     <% jsCATCH %>
  135. }
  136.  
  137. ///////////////////////////////////////////////////////////////////////
  138. function EnableWrapper()
  139. {
  140.     <% jsTRY %>
  141.     document.location.replace( "<%= "pubpoint_ads.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID %>&op=togglepath&enableWrapper=on" );
  142.     <% jsCATCH %>
  143. }
  144.  
  145. ///////////////////////////////////////////////////////////////////////
  146. function DisableWrapper()
  147. {
  148.     <% jsTRY %>
  149.     document.location.replace( "<%= "pubpoint_ads.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID %>&op=togglepath&enableWrapper=off" );
  150.     <% jsCATCH %>
  151. }
  152.  
  153. ///////////////////////////////////////////////////////////////////////
  154. function EnableWrapperPath()
  155. {
  156.     <% jsTRY %>
  157.     document.location.replace( "<%= "pubpoint_ads.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID %>&op=togglepath&enableWrapper=on" );
  158.     <% jsCATCH %>
  159. }
  160.  
  161. ///////////////////////////////////////////////////////////////////////
  162. function ValidateInput()
  163. {
  164.     <% jsTRY %>
  165.     ValidatePath();
  166.     
  167.     if( document.mainForm.change.disabled )
  168.     {
  169.         event.cancelBubble=1;
  170.         return false;
  171.     }
  172.     <% jsCATCH %>
  173. }
  174.  
  175. var g_bIllegalPathAlerted = false;
  176.  
  177. ///////////////////////////////////////////////////////////////////////
  178. function ValidatePath()
  179. {
  180.     <% jsTRY %>
  181.     var szPath = new String( document.forms.mainForm.path.value );
  182.     
  183.     // perform left trim
  184.     szPath = szPath.replace( /^\s+/, "" );
  185.  
  186.     // perform right trim
  187.     szPath = szPath.replace( /\s+$/, "" );
  188.     
  189.     var szIllegalChars = /;|\^|\'|\<|\>|\`|\f|\n|\r/gi;
  190.     if( -1 != szPath.search( szIllegalChars ) )
  191.     {
  192.         document.forms.mainForm.change.disabled = true;
  193.         document.forms.mainForm.path.style.color="#ff0000";
  194.         window.status = "<%= L_INVALIDCHARSINPATH_TEXT %>";
  195.         if( ! g_bIllegalPathAlerted )
  196.         {
  197.             g_bIllegalPathAlerted = true;
  198.             window.alert( "<%= L_INVALIDCHARSINPATH_TEXT %>" );
  199.         }
  200.         return;
  201.     }
  202.     
  203.     <% if( bReloadedForPathError )then %>
  204.     if( szPath != "<%= UnescapeFilePathSlashes( TrimFileColon( strNewPath ) ) %>" )
  205.     <% else %>
  206.     if( szPath != "<%= UnescapeFilePathSlashes( TrimFileColon( strCurrentWrapperPath ) ) %>" )
  207.     <% end if %>
  208.     {
  209.         document.forms.mainForm.change.disabled = false;
  210.         document.forms.mainForm.path.style.color="#000000";
  211.     }
  212.     else
  213.     {
  214.         document.forms.mainForm.change.disabled = true;
  215.     <% if( bReloadedForPathError )then %>
  216.         document.forms.mainForm.path.style.color="#ff0000";
  217.     <% end if %>
  218.     }
  219.     <% jsCATCH %>
  220. }
  221. -->
  222. </script>
  223. </head>
  224. <body bgcolor="white" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0" onLoad="JavaScript:ValidatePath();" oncontextmenu="JavaScript:event.cancelBubble=true;return false;">
  225. <%
  226. ' Draw the page banner and tabs
  227. DrawPPNameBanner L_ADSTABTITLE_TEXT
  228. %>
  229. <br>
  230. <form name="mainForm" method="post" action="<%= RemoveDangerousCharacters( g_strQueryString ) %>" onsubmit="JavaScript:return( ValidateInput() );" AUTOCOMPLETE="OFF">
  231. <input type="hidden" name="server" value="<%= RemoveSpecifiedChars( g_strQueryStringServer, "\f|\n|\r|<|>" ) %>">
  232. <input type="hidden" name="ppID" value="<%= RemoveSpecifiedChars( g_strPubPointID, "\f|\n|\r|<|>" ) %>">
  233. <input type="hidden" name="op" value="ChangeWrapper">
  234. <table cellpadding="2" cellspacing="2" class="tabwhitearea" STYLE="BORDER-COLLAPSE: collapse">
  235.     <tr>
  236.         <td colspan="2"><p class="helptext"><%= Server.HTMLEncode( L_PPADSLEARN_TEXT ) %></p></td>
  237.     </tr>
  238.     <tr>
  239.         <td colspan="2"><b><a tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> oncontextmenu="JavaScript:event.cancelBubble=true;return false;" href="JavaScript:DoHelp( '/', '<%= Server.HTMLEncode( H_USINGPPADSTOPIC ) %>' );"><%= Server.HTMLEncode( L_PPADSLEARNLINK_TEXT ) %></a></b><br> </td>
  240.     <tr>
  241.         <td colspan="2"><p class="helptext"><%= Server.HTMLEncode( L_ADDPPADS_TEXT ) %></p></td>
  242.     </tr>
  243.     <tr><!-- Nested Table 4 - Group Box -->
  244.         <td align="left" width="20">
  245.              
  246.         </td>
  247.         <td align="left" class="tabwhitearea" STYLE="BORDER-COLLAPSE: collapse">
  248.             <table class="groupbox" width="90%" cellspacing="2" cellpadding="2" border="0" cols="3">
  249.                 <tr>
  250.                     <td colspan="3" class="subheader"><IMG height="32" src="img/inter_advert_32.gif" width="32" align="left" border="0"><%= Server.HTMLEncode( L_INTERADS_TEXT ) %></td>
  251.                 </tr>
  252.                 <tr>
  253.                     <td colspan="3" class="helptext"><%= Server.HTMLEncode( L_PPADSHELP_TEXT ) %></td>
  254.                 </tr>
  255.                 <tr><td colspan="3"><hr size="1"></td></tr>
  256.                                             
  257.                 <tr>
  258.                     <td colspan="3" class="subheader"><IMG height="32" src="img/wpleditor_updated_32.gif" width="32" align="left" border="0"><%= Server.HTMLEncode( L_ADSINWRP_TEXT ) %></td>
  259.                 </tr>
  260.                 <tr>
  261.                     <td colspan="3" class="helptext">
  262.                         <%= Server.HTMLEncode( L_WRAPPERHELP_TEXT ) %>
  263.                     </td>
  264.                 </tr>
  265.                 <tr>
  266.                     <td width="16">
  267.                         <input 
  268.                             type="checkbox" <% if bWrapperPathEnabled then %>checked<% end if %> 
  269.                             name="useWrapperCheckbox" 
  270.                             value="" 
  271.                             id="useWrapperCheckbox" 
  272.                             onChange="JavaScript:<% if bWrapperPathEnabled then %>DisableWrapper();<% else %>EnableWrapper();<% end if %>" 
  273.                             onClick="JavaScript:<% if bWrapperPathEnabled then %>DisableWrapper();<% else %>EnableWrapper();<% end if %>" 
  274.                             tabIndex=<%= dwTabIndex %><% dwTabIndex = dwTabIndex + 1 %>>
  275.                     </td>
  276.                     <td colspan="2">
  277.                         <label for="useWrapperCheckbox" class="handcursor"><%= L_USEWRAPPER_TEXT %></label>
  278.                     </td>
  279.                 </tr>
  280.                 <tr>
  281.                     <td width="16">
  282.                         <img src="WMSspacer.gif" height="0" width="16" border="0">
  283.                     </td>
  284.                     <td class="helptext" nowrap><%= Server.HTMLEncode( L_ADSTABHELPSTRING_TEXT ) %></td>
  285.                     <td> </td>
  286.                 </tr>
  287.                 <tr>
  288.                     <td width="16">
  289.                         <img src="WMSspacer.gif" height="0" width="16" border="0">
  290.                     </td>
  291.                     <td nowrap>
  292.                         <input 
  293.                             type="text"
  294.                             name="path" 
  295.                             maxlength="<%= Server.HTMLEncode( MAX_PATH ) %>"
  296.                             value="<% 
  297.                             if ( bReloadedForPathError or bError ) and ( 0 < Len( strNewPath ) ) then 
  298.                                 Response.Write( strNewPath ) 
  299.                             else 
  300.                                 Response.Write( TrimFileColon( strCurrentWrapperPath ) ) 
  301.                             end if %>" 
  302.                             onKeyUp="JavaScript:ValidatePath();" 
  303.                             onKeyDown="JavaScript:ValidatePath();" 
  304.                             onChange="JavaScript:ValidatePath();"
  305.                             onPaste="JavaScript:ValidatePath();"
  306.                             size="<% if brMSIE = g_dwBrowserType then Response.Write( "80" ) else Response.Write( "40" ) end if %>" 
  307.                             <% if bError and ( 0 < Len( strNewPath ) ) then %>style="color:red;"<% end if %>
  308.                             AUTOCOMPLETE="OFF"
  309.                             <% if FALSE = bWrapperPathEnabled then %> disabled <% else %> tabIndex=<%= dwTabIndex %><% dwTabIndex = dwTabIndex + 1 %><%end if %>
  310.                             >
  311.                     </td>
  312.                     <td>
  313.                         <input
  314.                             type="submit"
  315.                             value="<%= Server.HTMLEncode( L_APPLYBUTTON_TEXT ) %>" 
  316.                             id="change"
  317.                             name="change"
  318.                             align="left" 
  319.                             <% if bWrapperPathEnabled then %> tabIndex=<%= dwTabIndex %> <% dwTabIndex = dwTabIndex + 1 %> <% end if %>
  320.                             disabled>
  321.                     </td>
  322.               </tr>
  323.             </table><!-- End Nested Table 4 Group Box-->
  324.         </td>
  325.     </tr>
  326. </table>
  327. </form>
  328. <tr>
  329.     <td>
  330.         <table width=100% border="0">
  331.         <tr>
  332.               <td colspan=5> </td>
  333.         </tr>
  334.         <tr>
  335.             <td>
  336.             <p>
  337.             <%
  338.                         
  339.     dwLastToolbarIndex = 0
  340.     if( Session( "ShowServerList" ) ) then
  341.             ToolbarButtonText ( dwLastToolbarIndex ) = L_BUTTONRETURNTOSERVERLIST_TEXT
  342.             ToolbarButtonImage( dwLastToolbarIndex ) = IMAGE_SERVERLIST
  343.             ToolbarButtonLink ( dwLastToolbarIndex ) = SERVERSLIST_PATH
  344.             ToolbarButtonAltText( dwLastToolbarIndex ) = L_RETURNTOSL_TEXT
  345.             dwLastToolbarIndex = dwLastToolbarIndex + 1
  346.     end if
  347.             ToolbarButtonText ( dwLastToolbarIndex ) = L_BUTTONHELP_TEXT
  348.             ToolbarButtonImage( dwLastToolbarIndex ) = IMAGE_HELP
  349.             ToolbarButtonLink ( dwLastToolbarIndex ) = HELPTOKEN
  350.             ToolbarButtonAltText( dwLastToolbarIndex ) = L_HELPALT_TEXT
  351.             ToolbarHelpURL = H_PPADSHELPTOPIC
  352.             ToolbarNesting = H_PPLEVEL
  353.             %>
  354. <% DrawToolbar TRUE, ( dwLastToolbarIndex + 1 ) %>
  355.             </td>
  356.         </tr>
  357.     </table>
  358.     </td>
  359. </tr>
  360. </table>
  361. </td></tr></table>
  362. <%
  363.     DrawRefreshControl TRUE
  364.     DrawCopyrightInfo
  365.     DrawStdFooter
  366.     if( bError ) then
  367.         AlertUserWithPopupErrorDialog
  368.         %>
  369.         <script language="JavaScript">
  370.             document.location = "pubpoint_ads.asp?server=<%= g_strQueryStringServer & "&invalidPath=" %>" + SafeEscape( document.forms.mainForm.path.value ) + "<%= "&ppID=" & g_strPubPointID %>";
  371.         </script>
  372.         <%
  373.     end if
  374. %>
  375. </body>
  376. </html>
  377. <%
  378. LatchCurrentPage "pubpoints/pubpoint_ads.asp", qs
  379. EndErrorHandling "pubpoint_ads.asp" 
  380.  
  381. on error resume next
  382. WMSServerHashASPCleanup
  383. WMSConnectASPCleanup
  384. %>